package chapter6;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class GameTest {
	private static Game game;
	
	@Before
	public void setUp(){
		game = new Game();
	}

	@Test
	public void testScoreNoThrows() {
		game.add(5);
		game.add(4);
		assertEquals(game.score(), 9);
	}
	
	@Test
	public void testOneThrow(){
		game.add(5);
		assertEquals(game.score(), 5);
	}
	
	@Test
	public void testTwoThrow(){
		game.add(5);
		game.add(4);
		assertEquals(game.score(), 9);
	}
	
	@Test
	public void testFourThrow(){
		game.add(5);
		game.add(4);
		game.add(7);
		game.add(2);
		assertEquals(game.score(), 18);
		assertEquals(game.scoreForFrame(1), 9);
		assertEquals(game.scoreForFrame(2), 18);
	}
}
